﻿using NPinyin;
using System.Globalization;
using System.Windows.Data;
using VideoTools.Extension;
using VideoTools.vo;

namespace VideoTools.Converters
{
    public class LanguageConverter1 : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
                return null;
            GoogleTranslateLanguage lang = (GoogleTranslateLanguage)value;
            string py = Pinyin.GetPinyin(lang.Desc());
            string fl = py.Substring(0, 1).ToUpper();
            return fl;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
        
    }
}
